﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Com.AAS.Common.Manager;
using Com.AAS.Toolbox.DataMirror.Server;

namespace Com.AAS.Toolbox.DataMirror.GUI
{
    public partial class LogForm : Form
    {
        private List<LogData> logs = new List<LogData>();
        public LogForm()
        {
            InitializeComponent();

            NoticeHandler handler = NoticeMananger.Instance.Registor("FILE_SYSTEM_LOG");
            handler.OnNotifyEvent += FileSystemLogHandlerImpl_OnNotifyEvent;
            handler.ToStart();

            this.dataGridView1.DataSource = logs; 
        }

        void FileSystemLogHandlerImpl_OnNotifyEvent(object send, object[] args)
        {
            LogData item = args[0] as LogData;
            if (item != null)
            {
                logs.Add(new LogData(item.Level, item.Title, item.Message));
            }
        }
    }
}
